package com.itheima.log;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

public class LogRunnable implements Runnable {
    private String message;

    public LogRunnable(String message) {
        this.message = message;
    }

    @Override
    public void run() {
        Log log = new Log(message);
        try (BufferedWriter bw = new BufferedWriter(new FileWriter("AnimalManager\\dirs\\log.txt", true));) {
            bw.write(log.toString());
            bw.newLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
